package Util::TuanStore::TuanStoreSearch;
use Moose;
use namespace::autoclean;

has 'schema' => (
	is => 'rw',
	required => 1,
	isa => 'DBIx::Class::Schema',
);

sub get_stores_bianhao {
	my ($self, $tuan_id) = @_;

	my @stores = $self->schema->resultset('TuanStore')->search(
			{'me.tuan_id' => $tuan_id,
			}
			);
	my %bianhao;
	my $count = 1;
	foreach(@stores) {
		$bianhao{$_->stores_id} = $count;
		$count ++;
	}
	return \%bianhao;
}

sub get_stores_price {
	my ($self, $tuan_id) = @_;

	my @stores = $self->schema->resultset('TuanStore')->search(
			{'me.tuan_id' => $tuan_id,
			}
			);
        my %bianhao;
	my %price;
        my $count = 1;
        foreach(@stores) {
		$price{$count} = $_->price;
                $count ++;
        }

	return \%price;
}

sub get_stores_price_new {
	my ($self, $tuan_id) = @_;

	my @stores = $self->schema->resultset('TuanStore')->search(
			{'me.tuan_id' => $tuan_id,
			}
			);
        my %bianhao;
	my %price;
        foreach(@stores) {
		$price{$_->stores_id} = $_->price;
        }

	return \%price;
}

__PACKAGE__->meta->make_immutable;

1;
